/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package koor.authorization;

import koor.entity.User;
import koor.persistent.UserDAO;
import koor.service.ServiceLocator;


/**
 * The
 * <code>UserAuthorisationFactory</code> class creates UserAuthorisation objects
 * for every user
 * @author Admin
 */
public class UserAuthorisationFactory {

    public static UserAuthorisation getAuthorizedUser(String login) {

        UserAuthorisation authorisation = new UserAuthorisation();
        authorisation.setAutorised(true);

        UserDAO userDao = ServiceLocator.getService(UserDAO.class);
        User user = userDao.findByCriteria(login,"login").get(0);
        
        authorisation.setUser(user);

        return authorisation;
    }
}
